package com.jy.adscm.operation.hscrb.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.jy.adscm.bean.system.JyUser;
import com.jy.adscm.operation.hscrb.bean.MjglMouldinfo;
import com.jy.adscm.operation.hscrb.bean.MjglMouldinfo;
import com.jy.adscm.operation.hscrb.mapper.mysql.MjglMouldinfoMapper;
import com.jy.adscm.operation.hscrb.service.MjglMouldinfoService;
import com.jy.adscm.system.mapper.mysql.JyUserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author zyl
 * @since 2018-12-18
 */
@Service
public class MjglMouldinfoServiceImpl extends ServiceImpl<MjglMouldinfoMapper, MjglMouldinfo> implements MjglMouldinfoService {
   @Autowired
   JyUserMapper jyUserMapper;
    @Override
    public List<MjglMouldinfo> selectByTid(String tid) {
        Wrapper<MjglMouldinfo> wrapper =new EntityWrapper<>();
        wrapper.eq("TID",tid);
        List<MjglMouldinfo> mjglMouldinfos = super.selectList(wrapper);
        for (MjglMouldinfo mjglMouldinfo : mjglMouldinfos) {
            if (mjglMouldinfo.getPerson()!=null && !"".equals(mjglMouldinfo.getPerson())){
                JyUser jyUser = jyUserMapper.selectById(mjglMouldinfo.getPerson());
                mjglMouldinfo.setPersonName(jyUser.getName());
            }
        }
        return mjglMouldinfos;
    }
}
